/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tableModel;

import java.awt.Dimension;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;

/**
 *
 * @author Marcio
 */
public class MotoristaRenderes {
    
    public static void defineRenderers(JTable tabela) {
        DefaultTableCellRenderer rendererCentro = new DefaultTableCellRenderer();
        rendererCentro.setHorizontalAlignment(SwingConstants.CENTER);
        DefaultTableCellRenderer rendererDireita = new DefaultTableCellRenderer();
        rendererDireita.setHorizontalAlignment(SwingConstants.RIGHT);
        DefaultTableCellRenderer rendererEsquerda = new DefaultTableCellRenderer();
        rendererEsquerda.setHorizontalAlignment(SwingConstants.LEFT);

        JTableHeader header = tabela.getTableHeader();
        header.setPreferredSize(new Dimension(0, 15));
        TableColumnModel modeloDaColuna = tabela.getColumnModel();

        modeloDaColuna.getColumn(0).setCellRenderer(rendererCentro);
        modeloDaColuna.getColumn(1).setCellRenderer(rendererEsquerda);
        //modeloDaColuna.getColumn(2).setCellRenderer(rendererCentro);

        modeloDaColuna.getColumn(0).setMaxWidth(50);
        modeloDaColuna.getColumn(1).setMaxWidth(1000);
        //modeloDaColuna.getColumn(2).setMaxWidth(325);
        //modeloDaColuna.getColumn(2).setMinWidth(225);
        //modeloDaColuna.getColumn(3).setMaxWidth(195);
    }
    
}
